<template>
  <div class="info">
    <tinymce v-model="value" :height="500" />
    <div class="action">
      <el-button type="primary" @click="submitForm">立即保存</el-button>
    </div>
  </div>
</template>

<script>
import Tinymce from "@/components/Tinymce";
import { getTools, saveTools } from "@/api/tools";
export default {
  name: "group",
  components: { Tinymce },

  data() {
    return {
      value: "",
    };
  },
  mounted() {
    this.getTools();
  },
  methods: {
    async getTools() {
      const res = await getTools({
        name: "communication_group",
      });
      if (res.data) {
        this.value = res.data.value;
      }
    },
    async submitForm() {
      const res = await saveTools({
        name: "communication_group",
        value: this.value,
      });
      if (res) {
        this.$message({
          message: res.msg,
          type: "success",
        });
      }
    },
  },
};
</script>
<style lang="scss" scoped>
.action {
  margin-top: 20px;
  display: flex;
  justify-content: center;
}
</style>